# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-python-pytun
pkgname=('python2-python-pytun' 'python-python-pytun')
_pkgname=python-pytun
pkgver=2.4.1
pkgrel=5
pkgdesc='A Python module which let you create TUN/TAP device very easily.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/python-pytun/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
replaces=('python2-pytun' 'python-pytun')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('4a831ac12dbbd1093f661962611d51c3e53b344956082b8e3f1b807a422e844bca6dd3e6342e87820892622002c26dabf4edfeb17494307bfe6f31792cda0d35')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-python-pytun() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-python-pytun() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

